import request from '../utils/request';
import { getUid } from '../utils/token';

export async function queryPictures({ type }) {
  return request(`/push/${type}`);
}

export async function queryTargetPictures({ uid }) {
  return request(`/mine/${uid}`);
}

export async function queryFavlist() {
  return request(`/collected/${getUid()}`);
}

export async function like({ params }) {
  return request(`/like`, {
    method: 'POST',
    body: params,
  });
}

export async function addToFavlist({ params }) {
  return request(`/collect`, {
    method: 'POST',
    body: {
      ...params,
      uid: getUid(),
    },
  });
}

export async function removeFromFavlist({ id }) {
  return request(`/collect/${id}`, {
    method: 'DELETE',
  });
}

export async function comment({ params }) {
  return request(`/comments`, {
    method: 'POST',
    body: params,
  });
}
